﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

//using Microsoft.Xna.Framework.Graphics;

namespace GameObjects
{
    [Serializable]
    public class TerrainType
    {
        [XmlElement("Id")]
        public int Id { get { return Code; } }

        [XmlElement("Code")]
        public char Code;
        [XmlElement("Name")]
        public string Name;

        [XmlElement("MovementType")]
        public string MovementTypeString
        {
            get { return MovementType.ToString(); }
            set { MovementType = (MetaData.MoveType) Enum.Parse(typeof (MetaData.MoveType), value); }
        }
        [XmlIgnore]
        public MetaData.MoveType MovementType;

        [XmlElement("MovementCost")]
        public string MovementCostString
        {
            get { return MovementCost.ToString(); }
            set { MovementCost = (MetaData.MovementCost)Enum.Parse(typeof(MetaData.MovementCost), value); }
        }
        [XmlIgnore]
        public MetaData.MovementCost MovementCost;

        [XmlElement("StackLimit")]
        public int StackLimit;
        [XmlElement("Colour")]
        public string Colour;
        [XmlElement("SpazFactor")]
        public float SpazFactor;

        public TerrainType() { }

        public TerrainType(char code, string name, MetaData.MoveType movementType, MetaData.MovementCost movementCost, int stackLimit, string colour, float spazFactor)
        {
            Code = code;
            Name = name;
            MovementType = movementType;
            MovementCost = movementCost;
            StackLimit = stackLimit;
            Colour = colour;
            SpazFactor = spazFactor;
        }

        public override string ToString()
        {
            return Name;
        }
    }
}
